<?php
/******************************************************
 ** HOME 模板赠送接口
 ** function  : 赠送用户模板
 ** parameter : $user-用户名 $tid模板ID $type 类型，其值说明：''或'tpl'-模板 flash-欢迎动画 mp3-播放器 mouse-鼠标 fly-漂浮
 ** return    : [0 fail] [1 success]
 ******************************************************/
function ActProductPort_SendTemplate($user,$tid,$type)
{
	$sTemp = "fdakdid83k3ladaaldfladfalf88338983832akd83a";
	$sTemp = md5($user.$tid.$sTemp);
	//$url   = 'http://home.51.com/include/interface/interface.tpl.php?user='.$user.'&sid='.$tid.'&key='.$sTemp.'&type='.$type;
	$new_url = 'http://home.51.com/?u='.$user.'&c=act&a=actinter';
	$key = interface_getchangetplkey($user,$tid,$tid,$type);
	/**$arrPost = array(
			'sid' => $tid,
			'pid' => $tid,
			'type' => $type,
			'key' => interface_getchangetplkey($user,$tid,$tid,$type)
	);**/
	$postString = "sid={$tid}&pid={$tid}&type={$type}&key={$key}";
	$rs    = commonCurlRequest($new_url,$postString);
	return $rs;	
}


//设置key函数
function interface_getchangetplkey($user, $sid, $pid = 0, $type = '')
{
	$sid = abs($sid);
	$pid = intval($pid);
	$sTemp = 'fdakdid83k3ladaaldfladfalf88338983832akd83a';
	if($pid <= 0)
	{
		$sTemp = md5($user.$sid.$sTemp);
	}
	else
	{
		$sTemp = md5($user.$sid.$pid.$type.$sTemp);
	}
	return $sTemp;
}

?>